<?php

/**
 * CompraInternacional filter form base class.
 *
 * @package    dirsac
 * @subpackage filter
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCompraInternacionalFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'per'                => new sfWidgetFormFilterInput(),
      'cuenta_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cuenta'), 'add_empty' => true)),
      'moneda_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Moneda'), 'add_empty' => true)),
      'nombre_encargado'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'correo_encargado'   => new sfWidgetFormFilterInput(),
      'anexo_encargado'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'proveedor_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ProveedorInternacional'), 'add_empty' => true)),
      'tipo'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'estado'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'forma_pago'         => new sfWidgetFormChoice(array('choices' => array('' => '', 'Cheque' => 'Cheque', 'Efectivo' => 'Efectivo', 'Tarjeta' => 'Tarjeta'))),
      'plazo_entrega'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'nombre_contacto'    => new sfWidgetFormFilterInput(),
      'correo_contacto'    => new sfWidgetFormFilterInput(),
      'telefono_contacto'  => new sfWidgetFormFilterInput(),
      'factura'            => new sfWidgetFormFilterInput(),
      'packing'            => new sfWidgetFormFilterInput(),
      'cotizacion'         => new sfWidgetFormFilterInput(),
      'otros'              => new sfWidgetFormFilterInput(),
      'agencia_de_aduanas' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'freight_forwarder'  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'con_cargonet'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'total'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'observacion'        => new sfWidgetFormFilterInput(),
      'created_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'per'                => new sfValidatorPass(array('required' => false)),
      'cuenta_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Cuenta'), 'column' => 'id')),
      'moneda_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Moneda'), 'column' => 'id')),
      'nombre_encargado'   => new sfValidatorPass(array('required' => false)),
      'correo_encargado'   => new sfValidatorPass(array('required' => false)),
      'anexo_encargado'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'proveedor_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ProveedorInternacional'), 'column' => 'id')),
      'tipo'               => new sfValidatorPass(array('required' => false)),
      'estado'             => new sfValidatorPass(array('required' => false)),
      'forma_pago'         => new sfValidatorChoice(array('required' => false, 'choices' => array('Cheque' => 'Cheque', 'Efectivo' => 'Efectivo', 'Tarjeta' => 'Tarjeta'))),
      'plazo_entrega'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'nombre_contacto'    => new sfValidatorPass(array('required' => false)),
      'correo_contacto'    => new sfValidatorPass(array('required' => false)),
      'telefono_contacto'  => new sfValidatorPass(array('required' => false)),
      'factura'            => new sfValidatorPass(array('required' => false)),
      'packing'            => new sfValidatorPass(array('required' => false)),
      'cotizacion'         => new sfValidatorPass(array('required' => false)),
      'otros'              => new sfValidatorPass(array('required' => false)),
      'agencia_de_aduanas' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'freight_forwarder'  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'con_cargonet'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'total'              => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'observacion'        => new sfValidatorPass(array('required' => false)),
      'created_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('compra_internacional_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CompraInternacional';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'per'                => 'Text',
      'cuenta_id'          => 'ForeignKey',
      'moneda_id'          => 'ForeignKey',
      'nombre_encargado'   => 'Text',
      'correo_encargado'   => 'Text',
      'anexo_encargado'    => 'Number',
      'proveedor_id'       => 'ForeignKey',
      'tipo'               => 'Text',
      'estado'             => 'Text',
      'forma_pago'         => 'Enum',
      'plazo_entrega'      => 'Date',
      'nombre_contacto'    => 'Text',
      'correo_contacto'    => 'Text',
      'telefono_contacto'  => 'Text',
      'factura'            => 'Text',
      'packing'            => 'Text',
      'cotizacion'         => 'Text',
      'otros'              => 'Text',
      'agencia_de_aduanas' => 'Boolean',
      'freight_forwarder'  => 'Boolean',
      'con_cargonet'       => 'Boolean',
      'total'              => 'Number',
      'observacion'        => 'Text',
      'created_at'         => 'Date',
      'updated_at'         => 'Date',
    );
  }
}
